package com.one.rope.mvp.web.common.dto.admin.intention;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.one.rope.mvp.basecore.util.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Date;

/**
 * @author Weijian.Liu
 * @desc 意向数据列表返回
 * @date 2020/2/21 1:46
 */
@Data
@ApiModel
public class AdminIntentionListItemVO {

  @ApiModelProperty(value = "意向记录id")
  private Long id;

  @JsonIgnore
  @ApiModelProperty(value = "意向目标姓名")
  private String targetName;

  @JsonIgnore
  @ApiModelProperty(value = "意向目标企业名称")
  private String targetCompanyName;

  @JsonIgnore
  @ApiModelProperty(value = "意向人姓名")
  private String intentionName;

  @JsonIgnore
  @ApiModelProperty(value = "意向人企业名称")
  private String intentionCompanyName;

  @ApiModelProperty(value = "意向目标")
  private String target;

  @ApiModelProperty(value = "操作人")
  private String operator;

  @ApiModelProperty(value = "创建时间")
  @JsonProperty("create_time")
  private Date createTime;

  public String getTarget() {
    if (!StringUtils.isNullOrEmpty(targetCompanyName)) {
      return targetName + "-" + targetCompanyName;
    }
    return targetName;
  }

  public String getOperator() {
    if (!StringUtils.isNullOrEmpty(intentionCompanyName)) {
      return intentionName + "-" + intentionCompanyName;
    }
    return intentionName;
  }
}
